/*
  @Time : 2019/12/2
  @Author : 6362
*/
package service

import (
	"github.com/streadway/amqp"
	"gotest/src/db"
	"log"
)

func PushMq() {

	q, err3 := db.MqChannel.QueueDeclare(
		"hello", // name
		false,   // durable
		false,   // delete when unused
		false,   // exclusive
		false,   // no-wait
		nil,     // arguments
	)
	log.Println("err3:{}", err3)

	body := "Hello World!"
	err4 := db.MqChannel.Publish(
		"",     // exchange
		q.Name, // routing key
		false,  // mandatory
		false,  // immediate
		amqp.Publishing{
			ContentType: "text/plain",
			Body:        []byte(body),
		})
	log.Println("err4:{}", err4)
}
